package qing.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

import org.hibernate.validator.constraints.NotBlank;

@Entity
@Table
public class moneyLog {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;	
	
	//貌似解决并发控制数据问题
	@Version
	private Integer version;
	
	//时间戳
	@Temporal(value=TemporalType.TIMESTAMP)
	private Date dateCreated=new Date();
	
	@NotBlank
	private String title;
	
	private int flag;
	
	private Float money;
	
	private String remark;
	
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="userid")
	private Person person;


	public Integer getId() {
		return id;
	}


	public void setId(Integer id) {
		this.id = id;
	}


	public Integer getVersion() {
		return version;
	}


	public void setVersion(Integer version) {
		this.version = version;
	}


	public Date getDateCreated() {
		return dateCreated;
	}


	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}


	public String getTitle() {
		return title;
	}


	public void setTitle(String title) {
		this.title = title;
	}


	public int getFlag() {
		return flag;
	}


	public void setFlag(int flag) {
		this.flag = flag;
	}


	public Float getMoney() {
		return money;
	}


	public void setMoney(Float money) {
		this.money = money;
	}


	public String getRemark() {
		return remark;
	}


	public void setRemark(String remark) {
		this.remark = remark;
	}


	public Person getPerson() {
		return person;
	}


	public void setPerson(Person person) {
		this.person = person;
	}


	@Override
	public String toString() {
		return "moneyLog [id=" + id + ", dateCreated=" + dateCreated + ", title=" + title + ", flag=" + flag
				+ ", money=" + money + ", remark=" + remark + ", person=" + person + "]";
	}


	public moneyLog() {	}


	public moneyLog(String title, Float money, String remark, Person person) {
		super();
		this.title = title;
		this.money = money;
		this.remark = remark;
		this.person = person;
	}



	
	
	
	
}
